Skip to content

KAFKA-12177: apply log start offset retention before time and size based retention#10216

Merged
junrao merged 4 commits into
apache:trunkfrom
lbradstreet:KAFKA-12177
Mar 2, 2021
Merged

KAFKA-12177: apply log start offset retention before time and size based retention#10216
junrao merged 4 commits into
apache:trunkfrom
lbradstreet:KAFKA-12177

Conversation

@lbradstreet

@lbradstreet lbradstreet commented Feb 26, 2021

Copy link
Copy Markdown
Contributor

Log start offset retention is the cheapest retention to evaluate and does not require access to maxTimestamp fields for segments, nor segment sizes. In addition, it may unblock other types of retention such as time based retention. Without this change retention is not idempotent. It's possible for one deleteOldSegments call to delete segments due to log start offset retention, and a follow up call to delete due to time based retention, even if the time has not changed.

@lbradstreet

Copy link
Copy Markdown
Contributor Author

@junrao, could you please give this a look when you get a chance?

@satishd satishd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch @lbradstreet . +1.

@junrao junrao left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lbradstreet : Thanks for the PR. Just a minor comment below.

log.maybeIncrementLogStartOffset(1L, ClientRecordDeletion)
assertEquals(2, log.deleteOldSegments(),
"Expecting two segment deletions as log start offset retention should unblock time based retention")
//assertEquals(0, log.deleteOldSegments())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still needed?

@junrao junrao left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lbradstreet : Thanks for the PR. LGTM

@junrao
junrao merged commit 36d6165 into apache:trunk Mar 2, 2021
ijuma added a commit to ijuma/kafka that referenced this pull request Mar 3, 2021
* apache-github/trunk:
  KAFKA-12400: Upgrade jetty to fix CVE-2020-27223
  MINOR: Fix null exception in coordinator log (apache#10250)
  y
  KAFKA-12375: don't reuse thread.id until a thread has fully shut down (apache#10215)
  KAFKA-12177: apply log start offset retention before time and size based retention (apache#10216)
  KAFKA-12369; Implement `ListTransactions` API (apache#10206)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants